# -*- coding:utf-8 -*-
__author__ = 'gin.chen'
# 判断是否能抽取字符串
"""
描述：判断从一个字符串中是否能抓取出helloworld，可以不连续但是一定要保持顺序。
如helllllllo wwwwwwworld 但不能是helolllllworld。
"""


def check_is_extract(aa, bb):
    # try:
    str_index = 0
    for i in aa:
        cc = bb.find(i, str_index, len(bb))
        if cc != -1:
            str_index = cc + 1
        else:
            return 0
        # str_index = cc + 1 if (cc != -1) else 0
    return 1
    # except:
    #     return 0
    # return 1


if __name__ == '__main__':
    # print check_is_extract('helloworld','helollllworld')
    # print check_is_extract('helloworld','helllllllo wwwhewowwwworld')
    print check_is_extract('cayy', 'helcollllyworyld')
    print check_is_extract('cyya', 'helcllllyllo ww wwwcwworylad')
